# Contributor: Leon Marz <main@lmarz.org>
# Maintainer: Leon Marz <main@lmarz.org>
pkgname=blosc
pkgver=1.21.6
pkgrel=0
pkgdesc="A blocking, shuffling and lossless compression library"
url="https://blosc.org"
arch="all"
license="BSD-3-Clause"
makedepends="cmake lz4-dev samurai zlib-dev zstd-dev"
subpackages="$pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/Blosc/c-blosc/archive/v$pkgver.tar.gz"
builddir="$srcdir/c-blosc-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_BENCHMARKS=OFF \
		-DPREFER_EXTERNAL_LZ4=ON \
		-DPREFER_EXTERNAL_ZLIB=ON \
		-DPREFER_EXTERNAL_ZSTD=ON

	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=1 ctest -j4
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
f32ac9ca7dd473f32201cdf4b7bb61a89e8bc3e3d16e027d2c6dc1aa838cb47c42dfed6942c9108532b3920ed22a8c662e7451890177c9bbe6ec5b8ab65362b3  blosc-1.21.6.tar.gz
"
